<template>
    <div>
     <h1>显示科室信息列表</h1>
    </div>
    科室名称:
      <input type="text" v-model="ya.name">
      <input type="button" value="查询" @click="stea">
      <table class="table">   
          <thead>   
              <tr>  
                 <td>科室名称</td>
                 <td>图片</td>
                 <td>成立日期</td>
              </tr>
          </thead>

             <thead>   
              <tr v-for="a in data">  
                 <td>{{a.departmentNmae}}</td>
                 <td><img style="width:45px;height:45px;" :src="axios.defaults.baseURL+a.departmentImg"></td>
                 <td>{{moment(a.departmentDate).format("yyyy-MM-DD") }}</td>
              </tr>
          </thead>
      </table>
</template>

<script setup lang="ts">
 import axios from 'axios';
  import {ref,onMounted} from 'vue';
  import moment from 'moment';

  import {useRouter} from 'vue-router';
 onMounted(()=>{
    ShowDepartment();
    
 })

 const ya=ref({
     name:"",

 })
 const router=useRouter();

 const ShowDepartment=()=>{
    axios.get("https://localhost:7170/api/Department/ShowDepartment",{params:ya.value}).then(res=>{
 data.value=res.data;

    })
 }
 const stea=()=>{
 ShowDepartment();
 }
  const data=ref([{
      "departmentId": 3,
    "departmentDate": "2024-01-11T00:00:00",
    "departmentImg": "/pic/c822e8be-1543-477b-99c3-df186efd916a4.jpg",
    "departmentNmae": "精神科"
  }])


</script>

<style scoped>

</style>
